package com.timo.rabbitmq.handler;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Description: 类用途：
 * @Author: Timo
 * @Date: 2019/7/24 10:00
 */
@Slf4j
@Component
public class FanoutHandler {



    @RabbitListener(queues = "hello-queue")
    public void helloListener(String msg, Message message, Channel channel) {
        log.info("fanout :{}",msg);
    }

    @RabbitListener(queues = "#{timoPubSubFanoutQueue.name}")
    public void receiver1(String str) {
        System.out.println("receiver1++++++++++:" + str);
    }

    @RabbitListener(queues = "#{timoTwoPubSubFanoutQueue.name}")
    public void receiverTwo(String str) {
        System.out.println("receiverTwo++++++++++:" + str);
    }
}
